package com.qige.homework;

import java.math.BigDecimal;

public class homework4 {
    public static void main(String[] args) {
        //生成一个随机100内小数
        double num = Math.random() * 100;
        System.out.println("随机数为:" + num);
        BigDecimal bigDecimal = new BigDecimal(num);
        BigDecimal divide = bigDecimal.divide(new BigDecimal("1"), 2, BigDecimal.ROUND_DOWN);
        System.out.println("转换为:" + divide);
    }
}
